/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package medialibrary.persistence;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 *
 * @author user
 */
@Entity
@Table(name = "membercard")

public class Membercard implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "memberCardNr")
    private Integer memberCardNr;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "balance")
    private BigDecimal balance;
    @JoinColumn(name = "memberId", referencedColumnName = "memberId")
    @OneToOne(optional = false)
    private Membre memberId;

    public Membercard() {
    }

    public Membercard(Integer memberCardNr) {
        this.memberCardNr = memberCardNr;
    }

    public Membercard(Integer memberCardNr, BigDecimal balance) {
        this.memberCardNr = memberCardNr;
        this.balance = balance;
    }

    public Integer getMemberCardNr() {
        return memberCardNr;
    }

    public void setMemberCardNr(Integer memberCardNr) {
        this.memberCardNr = memberCardNr;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public void setBalance(BigDecimal balance) {
        this.balance = balance;
    }

    public Membre getMemberId() {
        return memberId;
    }

    public void setMemberId(Membre memberId) {
        this.memberId = memberId;
    }

    public String toString() {
        return memberCardNr + "";
    }
    
}
